import React, { Component } from 'react'
import { withRouter } from 'react-router-dom';
import { Modal } from 'antd'
import { LeftOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import './publish_top.less'
class PublisTop extends Component {

  goBack = () => {
    Modal.confirm({
      title: '确定放弃编辑文章并返回吗?',
      icon: <ExclamationCircleOutlined />,
      onOk:()=> {
        this.props.history.go(-1)
      },
      onCancel:()=>  {
        console.log('Cancel');
      },
    });
  }
  render() {
    return (
      <div className="publis-top-container">
        <div className="left" onClick={this.goBack}>
          <LeftOutlined />
          <span>返回</span>
        </div>
        <div>
          {this.props.children}
        </div>
      </div>
    )
  }
}
export default withRouter(PublisTop)

